package com.wondersgroup.mapper;


import com.wondersgroup.entity.Record;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

@Mapper
@Repository
public interface RecordMapper {


  List<Record> getRecordsByOpenId(@Param("openId") String openId) throws Exception;


  /**
   *  单位id  登记时间 手机号 获取 签到记录
   * @param sjh
   * @param djsj
   * @return
   */
  Record getDetail(@Param("dwid")String dwid,@Param("sjh") String sjh,@Param("djsj") Date djsj) throws Exception;

  /**
   * 签退
   */

   int  signOut(Record record);

  /**
   * 根据openId  dwid  kssj 和 jssj  查找访问记录
   *
   * @param openId
   * @param dwid
   * @param kssj
   * @param jssj
   * @return
   */

   List<Record> getRecordByOpenId(@Param("openId") String openId,@Param("dwid") String dwid, @Param("kssj")Date kssj ,@Param("jssj") Date jssj);


  /**
   *  新增记录
   */
   void addRecord(Record record) throws Exception;

  /**
   * h获取 某家单位 一段时间内 访客记录
   * @return
   */
  List <Record> getRecordsByDate(@Param("dwid") String dwid,@Param("kssj")Date kssj ,@Param("jssj") Date jssj,@Param("rowIndex") int rowIndex, @Param("pageSize") int pageSize,@Param("xm") String xm);


  /**
   * 根据单位获取 访客记录(不传 单位 默认查全部)
   */

  List<Record> getRecordsByCompany(@Param("dwid") String dwid,@Param("rowIndex") int rowIndex, @Param("pageSize") int pageSize) throws Exception;


  List<Record> getCompanyRecords(@Param("dwid") String dwid) throws Exception;


  /**
   * 获取全部 访客记录
   * @return
   */
  List<Record> getAllRecords();

}
